﻿Public Class TimeDef
    Public Sub New(ByVal Name As String, ByVal Offset As Integer, ByVal Path As String, ByVal args() As String)
        m_Name = Name
        m_Offset = Offset
        m_Path = Path
        m_args = args
        m_TimeLeft = Offset
        m_Active = True
    End Sub

    Private m_Name As String
    Public Property Name() As String
        Get
            Return m_Name
        End Get
        Set(ByVal value As String)
            m_Name = value
        End Set
    End Property

    Private m_Offset As Integer
    Public Property Offset() As Integer
        Get
            Return m_Offset
        End Get
        Set(ByVal value As Integer)
            m_Offset = value
        End Set
    End Property

    Private m_Path As String
    Public Property Path() As String
        Get
            Return m_Path
        End Get
        Set(ByVal value As String)
            m_Path = value
        End Set
    End Property

    Private m_TimeLeft As Integer
    Public ReadOnly Property TimeLeft() As Integer
        Get
            Return m_TimeLeft
        End Get
    End Property

    Private m_Active As Boolean
    Public Property Active() As Boolean
        Get
            Return m_Active
        End Get
        Set(ByVal value As Boolean)
            m_Active = value
        End Set
    End Property

    Private m_args As String()
    Public Property Args() As String()
        Get
            Return m_args
        End Get
        Set(ByVal value As String())
            m_args = value
        End Set
    End Property

    Public Sub Done()
        m_Active = False
        m_TimeLeft = 0
    End Sub

    Public Sub Tick()
        If m_TimeLeft > 0 Then
            m_TimeLeft -= 1
            Debug.WriteLine(m_Path & " time left: " & CStr(m_TimeLeft))
        End If
    End Sub

    Public Overrides Function ToString() As String
        Return CStr(m_TimeLeft) & ": " & m_Path
    End Function
End Class
